<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('用户信息(按kkuid分区)列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>用户ID：</p>
                                <input type="text" name="kkuid"/>
                            </li>
                            <li>
                                <p>用户昵称：</p>
                                <input type="text" name="uname"/>
                            </li>
                            <li>
                                <p>手机号：</p>
                                <input type="text" name="phone"/>
                            </li>
                            <li>
                                <p>审核权限：</p>
                                <select name="auditPermission" th:with="type=${@dict.getType('common_support')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="yuwen:kkuserInfo:export">
                    <i class="fa fa-download"></i> 导出
                 </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('yuwen:kkuserInfo:edit')}]];
        var removeFlag = [[${@permission.hasPermi('yuwen:kkuserInfo:remove')}]];
        var auditPermissionDatas = [[${@dict.getType('common_support')}]];
        var prefix = ctx + "yuwen/kkuserInfo";
        var audioListPrefix = ctx + "yuwen/yuwenaudio/userList"

        $(function() {
            var options = {
                sortName: "registertime",
     		    sortOrder: "desc",
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "用户信息(按kkuid分区)",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'kkuid', 
                    title : '用户ID',
                },
                {
                    field : 'phone', 
                    title : '绑定手机号'
                },
                {
                    field : 'uname', 
                    title : '用户名'
                },
                {
                    field : 'school', 
                    title : '学校'
                },
                {
                    field : 'gender', 
                    title : '性别'
                },
                {
                    field : 'uclass', 
                    title : '班级'
                },
                {
                    field : 'city', 
                    title : '城市'
                },
                {
                    field : 'birth', 
                    title : '出生年月'
                },
                {
                    field : 'grade', 
                    title : '年级'
                },
                {
                    field : 'registertime', 
                    title : '注册时间'
                },
                {
                    field : 'thumb', 
                    title : '头像地址',
                    formatter: function(value, row, index) {
                    	if(value){
                    		return $.table.imageView(value);
                        }
                    	return ''
                	}
                },
                {
                    field : 'major', 
                    title : 'major'
                },
                {
                    field : 'minor', 
                    title : 'minor'
                },
                {
                    field : 'auditPermission', 
                    title : '音频审核权限',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(auditPermissionDatas, value);
                    }
                },
                {
                    field : 'auditPermissionExpired', 
                    title : '权限过期时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.kkuid + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="statTopman(\'' + row.kkuid + '\')"><i class="fa fa-edit"></i>统计达人</a> ');
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="audioList(\'' + row.kkuid + '\',\'' + row.uname + '\')"><i class="fa fa-edit"></i>音频列表</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function audioList(kkuid, nickname) {
		    var url = audioListPrefix + "/" + kkuid;
		    $.modal.openTab(nickname + "朗讼作品列表", url);
		}

		function statTopman(kkuid){
           $.modal.confirm("确定要统计达人吗?", function() {
				$.operate.post(prefix + "/statTopman", { "kkuid": kkuid});
		   })
		}


    </script>
</body>
</html>